/*
* Copyright @2009-2012 www.happyelements.com, all rights reserved.
* Create date: 2012-7-27
* Piggy Dong
* 董文弈
* wenyi.dong@happyelements.com
*/
package com.happyelements.isolib
{
	import com.happyelements.display.HEMovieClip;
	
	import flash.geom.Point;

	/**
	 * @author dongpiggyi
	 */
	public class IsoTileAnimation extends IsoTileObject
	{
		
		private var _assetID:String;
		
		public var name:String;
		
		public function IsoTileAnimation(rowIndex:int, columnIndex:int, rows:int = 1, columns:int = 1)
		{
			super(rowIndex, columnIndex, rows, columns);
		}

		override public function set displayObject(displayObject:Object):void
		{
			if (displayObject is HEMovieClip)
			{
				super.displayObject = displayObject;
			}
			else
			{
				throw new Error("displayObject in IsoTileSprite must be AnimationDisplayObject");
			}
		}
		
		
		override public function setDisplayObjectPosition(point:Point):void
		{
			getTypedDisplayObject().x = point.x;
			getTypedDisplayObject().y = point.y;
		}
		
		public function getTypedDisplayObject():HEMovieClip
		{
			return HEMovieClip(displayObject);
		}

		public function get assetID():String
		{
			return _assetID;
		}

		public function set assetID(assetID:String):void
		{
			_assetID = assetID;
		}
		
		public function toString() : String 
		{
			return "[id: " + _assetID + " (" + rowIndex + ", " + columnIndex + "), size:(" + rows + ", " + columns + ")]";
		}
	}
}
